PROJECT (SAIPROJECT)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

SET(CMAKE_BUILD_BOARD "x86")
#SET(CMAKE_BUILD_BOARD "arm")

SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -Werror -g2 -ggdb")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
#SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -m32")
#SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -m32")

SET(ARCH "uml")
#SET(ARCH "arm64")

IF(${ARCH} STREQUAL "arm64")
    SET(CMAKE_C_COMPILER /opt/aarch64/bin/aarch64-linux-gnu-gcc)
    SET(CMAKE_CXX_COMPILER /opt/aarch64/bin/aarch64-linux-gnu-g++)
ENDIF(${ARCH} STREQUAL "arm64")

SET(CHIPNAME "tsingma")
SET(SDKHOME "../sdk")
SET(CONFIG_DBCLIENT 0)
SET(CONFIG_SHELLMODE 1)
SET(CONFIG_SAICLI 1)

SET(CONFIG_PLATFORM "other")

IF(${ARCH} STREQUAL "uml")
    ADD_DEFINITIONS(-DSDK_WORK_PLATFORM=1)
    ADD_DEFINITIONS(-DSDK_WORK_ENV=1)
ELSE(${ARCH} STREQUAL "uml")
    ADD_DEFINITIONS(-DSDK_WORK_PLATFORM=0)
    ADD_DEFINITIONS(-DSDK_WORK_ENV=1)
ENDIF(${ARCH} STREQUAL "uml")


ADD_DEFINITIONS(-DSDK_IN_USERMODE)


IF(${CHIPNAME} STREQUAL "tsingma")
    ADD_DEFINITIONS(-DTSINGMA)
ELSEIF(${CHIPNAME} STREQUAL "tsingma_mx")
    ADD_DEFINITIONS(-DTSINGMA_MX)
ENDIF(${CHIPNAME} STREQUAL "tsingma")

IF(CONFIG_DBCLIENT)
    SET(REDIS_INCLUDE_DIR "${SAIPROJECT_SOURCE_DIR}/db/redis/deps/hiredis")
    ADD_DEFINITIONS(-DCONFIG_DBCLIENT)
ENDIF(CONFIG_DBCLIENT)

IF(${CONFIG_PLATFORM} STREQUAL "ctc")
    ADD_DEFINITIONS(-DCTC_PLATFORM)
ENDIF(${CONFIG_PLATFORM} STREQUAL "ctc")

IF(CONFIG_SHELLMODE)
    ADD_DEFINITIONS(-DSHELL_MODE)
ENDIF(CONFIG_SHELLMODE)

ADD_DEFINITIONS(-Wall)
ADD_DEFINITIONS(-fPIC -Wno-long-long -Wformat)

IF(${ARCH} STREQUAL "arm64")
    ADD_DEFINITIONS(-Wno-unused )
ELSE(${ARCH} STREQUAL "arm64")
    ADD_DEFINITIONS(-m64)
ENDIF(${ARCH} STREQUAL "arm64")

IF(CONFIG_DBCLIENT)
    ADD_DEFINITIONS(-DCTCREDIS)
    ADD_SUBDIRECTORY(db)
ENDIF(CONFIG_DBCLIENT)

ADD_SUBDIRECTORY(centec)




MESSAGE(STATUS "This is BINARY dir "${SAIPROJECT_BINARY_DIR})
MESSAGE(STATUS "This is SOURCE dir "${SAIPROJECT_SOURCE_DIR})
MESSAGE(STATUS "This is BOARD type "${CMAKE_BUILD_BOARD})

